package com.user.mapper;

import com.bean.WmsTUser;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;


public interface LoadMapper {
    //判断账号密码
    @Select("select * from wms_t_user where userAccount = #{userAccount} and userPwd = #{userPwd}")
    public WmsTUser Load(@Param("userAccount") String userAccount, @Param("userPwd") String userPwd);

    @Select("SELECT siteID FROM wms_t_tray  WHERE trayState = '0'")
    public ArrayList<String> FindsiteID();

    @Select("SELECT storeID FROM wms_t_site  WHERE siteID = #{siteID}")
    public String FindstoreID(@Param("siteID") String siteID);

    @Select("SELECT storeName FROM wms_t_store WHERE storeID = #{storeID}")
    public String FindstoreName(@Param("storeID") String storeID);

    @Select("SELECT trayID FROM wms_t_tray WHERE siteID in (SELECT siteID FROM wms_t_site WHERE storeID in (SELECT storeID FROM wms_t_store WHERE storeName = '一号仓库'))")
    public List<String> FindtrayId();

    //根据userAccount查询数据库中的权限名
    @Select("select permName from wms_t_permission where permID in(select permID from wms_t_perm_group where groupID in(select uggroupID from wms_t_u_g where ugUserID in(select userId from wms_t_user where userAccount = #{value})))")
    public String JudgePermission(String userAccount);

    //查询登录页面的权限(下拉框
    @Select("select permName from wms_t_permission ")
    public List<String> QueryPermissions();

    //根据仓库名字找到各个位置的状态
    @Select("SELECT trayState FROM wms_t_tray WHERE  siteID IN (SELECT siteID FROM wms_t_site WHERE storeID IN (SELECT storeID FROM wms_t_store WHERE storeName = #{WareHouseName}))")
    public List<String> FindWarehouseState(String WareHouseName);

    //找到仓库使用明细页面的各个仓库名
    @Select("select storeName from wms_t_store")
    public List<String> FindWarehouseName();
}
